package com.xwh.week4;

import java.util.Arrays;
import java.util.HashSet;

public class Practice2 {//暴搜
    static int num=1;
    static String s;
    static HashSet<Integer> hashSet=new HashSet<>();
    public static void main(String[] args) {
        int sum=0;
        method();
        for (int i :hashSet) {
            sum+=i;
        }
        System.out.println(sum);
    }
    public static void method(){
        for(int left=1;left<100;left++){
            for(int right=100;right<10000;right++) {
                num = left * right;
                s = ""+num + left + right ;
                char[] chars = s.toCharArray();
                Arrays.sort(chars);
                s = new String(chars);
                if("123456789".equals(s)){
                    hashSet.add(num);
                }
            }
        }
    }
}
